File tree Expand file tree Collapse file tree 1 file changed +43
-0
lines changed
kitsune/products/migrations Expand file tree Collapse file tree 1 file changed +43
-0
lines changed Original file line number Diff line number Diff line change
1
+ # Generated by Django 4.2.21 on 2025-05-20 14:23
2
+
3
+ from django .db import migrations
4
+
5
+
6
+ def update_topic_title (apps , schema_editor ):
7
+ Topic = apps .get_model ("products" , "Topic" )
8
+
9
+ try :
10
+ topic = Topic .objects .get (
11
+ title = "Cookies" ,
12
+ is_archived = False ,
13
+ parent__title = "Tracking protection" ,
14
+ parent__is_archived = False ,
15
+ parent__parent__title = "Privacy and security" ,
16
+ parent__parent__is_archived = False ,
17
+ parent__parent__parent__isnull = True ,
18
+ )
19
+ except Topic .DoesNotExist :
20
+ print ('The topic "Privacy and security > Tracking protection > Cookies" does not exist.' )
21
+ except Topic .MultipleObjectsReturned :
22
+ print (
23
+ 'Multiple instances of the topic "Privacy and security > Tracking protection'
24
+ ' > Cookies" exist.'
25
+ )
26
+ else :
27
+ topic .title = "Cookies as trackers"
28
+ topic .save ()
29
+ print (
30
+ 'Successfully updated the title of the topic "Privacy and security > Tracking'
31
+ ' protection > Cookies" to "Cookies as trackers".'
32
+ )
33
+
34
+
35
+ class Migration (migrations .Migration ):
36
+
37
+ dependencies = [
38
+ ("products" , "0023_initial_topic_metadata" ),
39
+ ]
40
+
41
+ operations = [
42
+ migrations .RunPython (update_topic_title , migrations .RunPython .noop ),
43
+ ]
You can’t perform that action at this time.
0 commit comments